
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Excel数据导入 · Diboot组件文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-vuejs-2/vue.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Excel数据导出.html" />
    
    
    <link rel="prev" href="文件处理工具.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                



<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../基础.html">
            
                <a href="../基础.html">
            
                    
                    基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../基础/组件引入.html">
            
                <a href="../基础/组件引入.html">
            
                    
                    组件引入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../基础/SQL初始化.html">
            
                <a href="../基础/SQL初始化.html">
            
                    
                    SQL初始化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../消息组件.html">
            
                <a href="../消息组件.html">
            
                    
                    消息通知组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../消息组件/消息模板管理.html">
            
                <a href="../消息组件/消息模板管理.html">
            
                    
                    消息模板管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../消息组件/消息记录管理.html">
            
                <a href="../消息组件/消息记录管理.html">
            
                    
                    消息记录管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../消息组件/发送短信消息.html">
            
                <a href="../消息组件/发送短信消息.html">
            
                    
                    发送短信消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../消息组件/发送邮件消息.html">
            
                <a href="../消息组件/发送邮件消息.html">
            
                    
                    发送邮件消息
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../文件组件.html">
            
                <a href="../文件组件.html">
            
                    
                    文件处理组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="文件处理工具.html">
            
                <a href="文件处理工具.html">
            
                    
                    文件处理工具
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.2" data-path="Excel数据导入.html">
            
                <a href="Excel数据导入.html">
            
                    
                    Excel数据导入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="Excel数据导出.html">
            
                <a href="Excel数据导出.html">
            
                    
                    Excel数据导出
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="音频文件处理.html">
            
                <a href="音频文件处理.html">
            
                    
                    音频文件处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="图片文件处理.html">
            
                <a href="图片文件处理.html">
            
                    
                    图片文件处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="压缩文件处理.html">
            
                <a href="压缩文件处理.html">
            
                    
                    压缩文件处理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>



                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                

                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Excel数据导入</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#excel&#x6570;&#x636E;&#x5BFC;&#x5165;"><b>1. </b>Excel&#x6570;&#x636E;&#x5BFC;&#x5165;</a></li><ul><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;&#x6570;&#x636E;&#x5BFC;&#x5165;&#x9875;&#x9762;&#x7684;controller&#x4E0E;views"><b>1.1. </b>&#x521B;&#x5EFA;&#x6570;&#x636E;&#x5BFC;&#x5165;&#x9875;&#x9762;&#x7684;controller&#x4E0E;views</a></li><ul><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;controller"><b>1.1.1. </b>&#x521B;&#x5EFA;controller</a></li><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;views&#x6587;&#x4EF6;"><b>1.1.2. </b>&#x521B;&#x5EFA;views&#x6587;&#x4EF6;</a></li></ul><li><span class="title-icon "></span><a href="#baseexcelimportcontroller&#x76F8;&#x5173;&#x5C5E;&#x6027;&#x4E0E;&#x65B9;&#x6CD5;"><b>1.2. </b>BaseExcelImportController&#x76F8;&#x5173;&#x5C5E;&#x6027;&#x4E0E;&#x65B9;&#x6CD5;</a></li><ul><li><span class="title-icon "></span><a href="#&#x5C5E;&#x6027;"><b>1.2.1. </b>&#x5C5E;&#x6027;</a></li><li><span class="title-icon "></span><a href="#&#x65B9;&#x6CD5;"><b>1.2.2. </b>&#x65B9;&#x6CD5;</a></li></ul></ul></ul></div><a href="#excel&#x6570;&#x636E;&#x5BFC;&#x5165;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="excel&#x6570;&#x636E;&#x5BFC;&#x5165;"><a name="excel&#x6570;&#x636E;&#x5BFC;&#x5165;" class="anchor-navigation-ex-anchor" href="#excel&#x6570;&#x636E;&#x5BFC;&#x5165;"><i class="fa fa-link" aria-hidden="true"></i></a>1. Excel&#x6570;&#x636E;&#x5BFC;&#x5165;</h1>
<h2 id="&#x521B;&#x5EFA;&#x6570;&#x636E;&#x5BFC;&#x5165;&#x9875;&#x9762;&#x7684;controller&#x4E0E;views"><a name="&#x521B;&#x5EFA;&#x6570;&#x636E;&#x5BFC;&#x5165;&#x9875;&#x9762;&#x7684;controller&#x4E0E;views" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;&#x6570;&#x636E;&#x5BFC;&#x5165;&#x9875;&#x9762;&#x7684;controller&#x4E0E;views"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. &#x521B;&#x5EFA;&#x6570;&#x636E;&#x5BFC;&#x5165;&#x9875;&#x9762;&#x7684;controller&#x4E0E;views</h2>
<h3 id="&#x521B;&#x5EFA;controller"><a name="&#x521B;&#x5EFA;controller" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;controller"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.1. &#x521B;&#x5EFA;controller</h3>
<ul>
<li>&#x5728;controller&#x5305;&#x4E0B;&#x521B;&#x5EFA;&#x76F8;&#x5173;controller&#x7C7B;&#xFF0C;&#x5E76;&#x7EE7;&#x627F;<a href="">BaseExcelImportController</a>&#x7C7B;&#xFF0C;&#x5982;&#x4E0B;&#xFF1A;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-comment">// Excel&#x4E0A;&#x4F20;&#x6837;&#x4F8B;</span>
<span class="hljs-meta">@Controller</span>
<span class="hljs-meta">@RequestMapping</span>(<span class="hljs-string">&quot;/student/import&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">StudentImportController</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">BaseExcelImportController</span> </span>{
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> Logger logger = LogManager.getLogger(StudentImportController.class);

    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-keyword">private</span> StudentService studentService;

    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">protected</span> String <span class="hljs-title">getViewPrefix</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;student/import&quot;</span>;
    }

    <span class="hljs-comment">/***
    * &#x6839;&#x8DEF;&#x5F84;/
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">&quot;/&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">home</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
        <span class="hljs-keyword">return</span> list(request, modelMap);
    }

    <span class="hljs-comment">/***
    * &#x663E;&#x793A;&#x9996;&#x9875;&#x9762;
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">&quot;/list&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">list</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
        <span class="hljs-comment">// &#x52A0;&#x8F7D;&#x7B2C;&#x4E00;&#x9875;</span>
        <span class="hljs-keyword">return</span> listPaging(<span class="hljs-number">1</span>, request, modelMap);
    }

    <span class="hljs-comment">/**
    * &#x663E;&#x793A;&#x9996;&#x9875;-&#x5206;&#x9875;
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">&quot;/list/{pageIndex}&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">listPaging</span><span class="hljs-params">(@PathVariable(<span class="hljs-string">&quot;pageIndex&quot;</span>)</span><span class="hljs-keyword">int</span> pageIndex, HttpServletRequest request, ModelMap modelMap) <span class="hljs-keyword">throws</span> Exception</span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.listPaging(pageIndex, request, modelMap);
    }

    <span class="hljs-comment">/***
    * &#x9884;&#x89C8;&#x6570;&#x636E;
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">&quot;/preview&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">preview</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.preview(request, modelMap);
    }

    <span class="hljs-comment">/***
    * &#x9884;&#x89C8;&#x6570;&#x636E;
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">&quot;/previewSave&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">previewSave</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.previewSave(request, modelMap);
    }

    <span class="hljs-comment">/***
    * &#x663E;&#x793A;&#x67E5;&#x770B;&#x8BE6;&#x7EC6;&#x9875;&#x9762;
    * <span class="hljs-doctag">@return</span> view
    * <span class="hljs-doctag">@throws</span> Exception
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">&quot;/view/{importUid}&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">viewPage</span><span class="hljs-params">(@PathVariable(<span class="hljs-string">&quot;importUid&quot;</span>)</span>Object importUid, HttpServletRequest request, ModelMap modelMap) <span class="hljs-keyword">throws</span> Exception </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.viewPage(importUid, request, modelMap);
    }

    <span class="hljs-comment">/***
    * &#x521B;&#x5EFA;&#x7684;&#x540E;&#x53F0;&#x5904;&#x7406;
    * <span class="hljs-doctag">@return</span> view
    * <span class="hljs-doctag">@throws</span> Exception
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">&quot;/upload&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">upload</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.upload(request, modelMap);
    }

    <span class="hljs-comment">/***
    * Excel&#x6570;&#x636E;&#x5BFC;&#x5165;-&#x6570;&#x636E;&#x8F6C;&#x6362;&#x8F85;&#x52A9;&#x7C7B;
    */</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-keyword">protected</span> List&lt;String[]&gt; transform(List&lt;ExcelColumn&gt; excelColumns, List&lt;String[]&gt; dataList, <span class="hljs-keyword">boolean</span> isPreview) <span class="hljs-keyword">throws</span> Exception{
        <span class="hljs-keyword">if</span>(V.isEmpty(excelColumns)){
            <span class="hljs-keyword">return</span> dataList;
        }
        <span class="hljs-keyword">return</span> dataList;
    }

    <span class="hljs-meta">@Override</span>
    <span class="hljs-keyword">protected</span> Class&lt;?&gt; getModelClass() {
        <span class="hljs-keyword">return</span> Student.class;
    }

    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">protected</span> BaseService <span class="hljs-title">getBusinessService</span><span class="hljs-params">()</span> </span>{
       <span class="hljs-keyword">return</span> studentService;
    }
}
</code></pre>
<h3 id="&#x521B;&#x5EFA;views&#x6587;&#x4EF6;"><a name="&#x521B;&#x5EFA;views&#x6587;&#x4EF6;" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;views&#x6587;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.2. &#x521B;&#x5EFA;views&#x6587;&#x4EF6;</h3>
<ul>
<li>&#x521B;&#x5EFA;&#x76F8;&#x5173;views&#x6587;&#x4EF6;&#xFF0C;&#x5728;views&#x4E0B;&#x7684;&#x4E1A;&#x52A1;&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x65B0;&#x5EFA;import&#x6587;&#x4EF6;&#x5939;&#xFF0C;&#x5728;import&#x6587;&#x4EF6;&#x4E2D;&#x6DFB;&#x52A0;&#x76F8;&#x5173;&#x9875;&#x9762;&#x6587;&#x4EF6;&#xFF0C;&#x6BD4;&#x5982;&#x5728;&#x8BE5;&#x793A;&#x4F8B;&#x4E2D;&#x4E3A; <a href="">webapps/WEB-INF/views/student/import/</a> &#x6587;&#x4EF6;&#x5939;&#x4E0B;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x81EA;&#x5B9A;&#x4E49;&#x5176;&#x4ED6;&#x8DEF;&#x5F84;&#xFF0C;&#x4F46;&#x9700;&#x8981;&#x66F4;&#x6539;&#x4EE5;&#x4E0A;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x4E2D;&#x7684; <a href="">getViewPrefix()</a> &#x65B9;&#x6CD5;&#xFF0C;&#x8FD4;&#x56DE;&#x76F8;&#x5BF9;&#x5E94;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x8DEF;&#x5F84;&#x3002;</li>
<li>&#x5728;&#x521B;&#x5EFA;&#x7684;&#x76F8;&#x5173;import&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#xFF0C;&#x9700;&#x8981;&#x6709;&#x4E09;&#x4E2A;&#x6587;&#x4EF6;&#xFF0C;list.ftl, preview.ftl, view.ftl&#x3002;<ul>
<li><a href="">list.ftl</a> &#x663E;&#x793A;&#x4E0A;&#x4F20;&#x5217;&#x8868;&#x8BB0;&#x5F55;&#x7684;&#x9875;&#x9762;&#xFF0C;&#x5E76;&#x4E14;&#x63D0;&#x4F9B;&#x9009;&#x62E9;&#x6587;&#x4EF6;&#x548C;&#x63D0;&#x4EA4;&#x6587;&#x4EF6;&#x7B49;&#x529F;&#x80FD;&#x3002;</li>
<li><a href="">preview.ftl</a> &#x5982;&#x679C;&#x9700;&#x8981;&#x6709;&#x4E0A;&#x4F20;&#x6570;&#x636E;&#x9884;&#x89C8;&#x529F;&#x80FD;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x6709;&#x8BE5;&#x9875;&#x9762;&#xFF0C;&#x663E;&#x793A;&#x4E0A;&#x4F20;&#x6570;&#x636E;&#x5217;&#x8868;&#x3002;</li>
<li><a href="">view.ftl</a> &#x5BF9;&#x4E0A;&#x4F20;&#x540E;&#x7684;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x67E5;&#x770B;&#x3002;</li>
</ul>
</li>
</ul>
<h2 id="baseexcelimportcontroller&#x76F8;&#x5173;&#x5C5E;&#x6027;&#x4E0E;&#x65B9;&#x6CD5;"><a name="baseexcelimportcontroller&#x76F8;&#x5173;&#x5C5E;&#x6027;&#x4E0E;&#x65B9;&#x6CD5;" class="anchor-navigation-ex-anchor" href="#baseexcelimportcontroller&#x76F8;&#x5173;&#x5C5E;&#x6027;&#x4E0E;&#x65B9;&#x6CD5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. BaseExcelImportController&#x76F8;&#x5173;&#x5C5E;&#x6027;&#x4E0E;&#x65B9;&#x6CD5;</h2>
<h3 id="&#x5C5E;&#x6027;"><a name="&#x5C5E;&#x6027;" class="anchor-navigation-ex-anchor" href="#&#x5C5E;&#x6027;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1. &#x5C5E;&#x6027;</h3>
<ul>
<li><a href="">baseFileService</a> &#x6587;&#x4EF6;&#x5904;&#x7406;Service&#x5B9E;&#x4F8B;&#xFF0C;&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x76F8;&#x5173;&#x65B9;&#x6CD5;&#x5BF9;&#x6570;&#x636E;&#x5E93;file&#x8868;&#x8FDB;&#x884C;&#x589E;&#x5220;&#x6539;&#x67E5;&#x7B49;&#x64CD;&#x4F5C;&#x3002;</li>
<li><a href="">excelColumnService</a> Excel&#x4E0A;&#x4F20;&#x5217;&#x5B9A;&#x4E49;Service&#x5B9E;&#x4F8B;&#xFF0C;&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x76F8;&#x5173;&#x65B9;&#x6CD5;&#x5BF9;excel_column&#x6807;&#x8FDB;&#x884C;&#x589E;&#x5220;&#x6539;&#x67E5;&#x7B49;&#x64CD;&#x4F5C;&#x3002;</li>
<li><a href="">excelImportRecordService</a> &#x5BFC;&#x5165;&#x8BB0;&#x5F55;Service&#x5B9E;&#x4F8B;&#xFF0C;&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x76F8;&#x5173;&#x65B9;&#x6CD5;&#x5BF9;excel_import_record&#x8868;&#x8FDB;&#x884C;&#x76F8;&#x5173;&#x64CD;&#x4F5C;&#x3002;BaseExcelImportController&#x7C7B;&#x4E2D;&#x7684;&#x5904;&#x7406;&#x6D41;&#x7A0B;&#x5728;&#x4E0A;&#x4F20;&#x6210;&#x529F;&#x540E;&#x4E5F;&#x5C06;&#x81EA;&#x52A8;&#x6DFB;&#x52A0;&#x4E0A;&#x4F20;&#x8BB0;&#x5F55;&#x3002;</li>
<li><a href="">PARAM_IMPORT_UUID</a> &#x5BFC;&#x5165;&#x8BB0;&#x5F55;&#x5B57;&#x6BB5;&#xFF0C;&#x5185;&#x5BB9;&#x9ED8;&#x8BA4;&#x662F;&quot;importUid&quot;&#xFF0C;&#x4E0A;&#x4F20;&#x9884;&#x89C8;&#x9875;&#x9762;&#xFF0C;&#x5728;&#x63D0;&#x4EA4;&#x65F6;&#x5019;&#x9700;&#x8981;&#x63D0;&#x4EA4;&#x8BE5;&#x5B57;&#x6BB5;&#x548C;&#x76F8;&#x5BF9;&#x5E94;&#x7684;&#x503C;&#x3002;</li>
</ul>
<h3 id="&#x65B9;&#x6CD5;"><a name="&#x65B9;&#x6CD5;" class="anchor-navigation-ex-anchor" href="#&#x65B9;&#x6CD5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.2. &#x65B9;&#x6CD5;</h3>
<ul>
<li><a href="">getModelClass()</a> &#x83B7;&#x53D6;&#x4E1A;&#x52A1;Model&#x7C7B;&#xFF0C;&#x7EE7;&#x627F;&#x540E;&#x5FC5;&#x987B;&#x91CD;&#x5199;&#x8BE5;&#x65B9;&#x6CD5;&#xFF0C;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#x3002;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-keyword">protected</span> Class&lt;?&gt; getModelClass() {
    <span class="hljs-keyword">return</span> Student.class;
}
</code></pre>
<ul>
<li><a href="">getBusinessService()</a> &#x83B7;&#x53D6;&#x4E1A;&#x52A1;Service&#x5B9E;&#x4F8B;&#xFF0C;&#x96C6;&#x6210;&#x540E;&#x5FC5;&#x987B;&#x91CD;&#x5199;&#x8BE5;&#x65B9;&#x6CD5;&#xFF0C;&#x5B9E;&#x4F8B;&#x5982;&#x4E0B;&#x3002;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">protected</span> BaseService <span class="hljs-title">getBusinessService</span><span class="hljs-params">()</span> </span>{
    <span class="hljs-keyword">return</span> studentService;
}
</code></pre>
<ul>
<li><a href="">listPaging()</a> &#x83B7;&#x53D6;&#x4E0A;&#x4F20;&#x8BB0;&#x5F55;&#x5217;&#x8868;&#x6570;&#x636E;&#xFF0C;&#x5E76;&#x6839;&#x636E;&#x9875;&#x7801;&#x6765;&#x8FDB;&#x884C;&#x5206;&#x9875;&#xFF0C;&#x5E76;&#x6DFB;&#x52A0;&#x5230;modelMap&#x4E2D;<a href="">modelList</a>&#x5B57;&#x6BB5;&#xFF0C;&#x4F7F;&#x7528;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">&quot;/list&quot;</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">list</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
    <span class="hljs-comment">// &#x52A0;&#x8F7D;&#x7B2C;&#x4E00;&#x9875;</span>
    <span class="hljs-keyword">return</span> listPaging(<span class="hljs-number">1</span>, request, modelMap);
}

<span class="hljs-meta">@Override</span>
<span class="hljs-meta">@GetMapping</span>(<span class="hljs-string">&quot;/list/{pageIndex}&quot;</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">listPaging</span><span class="hljs-params">(@PathVariable(<span class="hljs-string">&quot;pageIndex&quot;</span>)</span><span class="hljs-keyword">int</span> pageIndex, HttpServletRequest request, ModelMap modelMap) <span class="hljs-keyword">throws</span> Exception</span>{
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.listPaging(pageIndex, request, modelMap);
}
</code></pre>
<ul>
<li><a href="">preview()</a> &#x9884;&#x89C8;&#x4E0A;&#x4F20;&#x6570;&#x636E;&#xFF0C;&#x5E76;&#x5C06;&#x4E0A;&#x4F20;&#x6570;&#x636E;&#x6DFB;&#x52A0;&#x5230;modelMap&#x4E2D;<a href="">dataList</a>&#x5B57;&#x6BB5;&#xFF0C;&#x4E0A;&#x4F20;&#x8BB0;&#x5F55;&#x6DFB;&#x52A0;&#x5230;<a href="">PARAM_IMPORT_UUID</a>&#x5E38;&#x91CF;&#x5B9A;&#x4E49;&#x7684;&#x5B57;&#x6BB5;&#x4E2D;&#xFF0C;&#x4F7F;&#x7528;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">&quot;/preview&quot;</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">preview</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.preview(request, modelMap);
}
</code></pre>
<ul>
<li><a href="">previewSave()</a> &#x9884;&#x89C8;&#x4FDD;&#x5B58;&#x6570;&#x636E;&#xFF0C;&#x7528;&#x6765;&#x5728;&#x9884;&#x89C8;&#x540E;&#x8FDB;&#x884C;&#x4FDD;&#x5B58;&#x6570;&#x636E;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x4F7F;&#x7528;&#x8BE5;&#x65B9;&#x6CD5;&#xFF0C;&#x9700;&#x8981;&#x5728;&#x524D;&#x7AEF;&#x5C06;&#x9884;&#x89C8;&#x65F6;&#x5019;&#x4F20;&#x5165;&#x5230;modelMap&#x4E2D;&#x7684;<a href="">PARAM_IMPORT_UUID</a>&#x5E38;&#x91CF;&#x5B57;&#x6BB5;&#x8868;&#x793A;&#x7684;&#x503C;&#x63D0;&#x4EA4;&#x5230;&#x540E;&#x7AEF;&#xFF0C;&#x7136;&#x540E;&#x83B7;&#x53D6;&#x76F8;&#x5173;&#x7684;dataList&#xFF0C;&#x4FDD;&#x5B58;&#x5230;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x4F7F;&#x7528;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">&quot;/previewSave&quot;</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">previewSave</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.previewSave(request, modelMap);
}
</code></pre>
<ul>
<li><a href="">upload()</a> &#x76F4;&#x63A5;&#x4E0A;&#x4F20;&#x6587;&#x4EF6;&#x6570;&#x636E;&#xFF0C;&#x76F4;&#x63A5;&#x4ECE;request&#x8BFB;&#x53D6;&#x4E0A;&#x4F20;excel&#x6587;&#x4EF6;&#xFF0C;&#x7136;&#x540E;&#x8BFB;&#x53D6;&#x8BE5;&#x6587;&#x4EF6;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x5217;&#x8868;&#xFF0C;&#x5E76;&#x4FDD;&#x5B58;&#x5230;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x4F7F;&#x7528;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-meta">@PostMapping</span>(<span class="hljs-string">&quot;/upload&quot;</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">upload</span><span class="hljs-params">(HttpServletRequest request, ModelMap modelMap)</span> <span class="hljs-keyword">throws</span> Exception </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.upload(request, modelMap);
}
</code></pre>
<ul>
<li><a href="">transform()</a> &#x8F6C;&#x6362;&#x6570;&#x636E;&#xFF0C;&#x4EE5;&#x53CA;&#x5BF9;&#x76F8;&#x5173;&#x5B57;&#x6BB5;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x5904;&#x7406;&#xFF0C;&#x5982;&#x679C;&#x5BF9;&#x67D0;&#x4E9B;&#x5B57;&#x6BB5;&#x7684;&#x6570;&#x636E;&#x6709;&#x81EA;&#x5B9A;&#x4E49;&#x5904;&#x7406;&#x7684;&#x9700;&#x6C42;&#xFF0C;&#x53EF;&#x4EE5;&#x91CD;&#x5199;&#x8BE5;&#x65B9;&#x6CD5;&#xFF0C;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-keyword">protected</span> List&lt;String[]&gt; transform(List&lt;ExcelColumn&gt; excelColumns, List&lt;String[]&gt; dataList, <span class="hljs-keyword">boolean</span> isPreview) <span class="hljs-keyword">throws</span> Exception{
    <span class="hljs-keyword">if</span>(V.isEmpty(excelColumns)){
        <span class="hljs-keyword">return</span> dataList;
    }
    <span class="hljs-keyword">return</span> dataList;
}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                

            </div>

            
                
                <a href="文件处理工具.html" class="navigation navigation-prev " aria-label="Previous page: 文件处理工具">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Excel数据导出.html" class="navigation navigation-next " aria-label="Next page: Excel数据导出">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Excel数据导入","level":"1.4.2","depth":2,"next":{"title":"Excel数据导出","level":"1.4.3","depth":2,"path":"文件组件/Excel数据导出.md","ref":"文件组件/Excel数据导出.md","articles":[]},"previous":{"title":"文件处理工具","level":"1.4.1","depth":2,"path":"文件组件/文件处理工具.md","ref":"文件组件/文件处理工具.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","sharing-plus","anchor-navigation-ex","theme-vuejs-2"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"theme-vuejs-2":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"mode":"float","pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"showLevel":true,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right","showGoTop":true,"isShowTocTitleIcon":true,"printLog":false,"multipleH1":true,"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false}},"sharing":{"qq":true,"all":["weibo","qq","linkedin","qzone","douban"],"douban":false,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Diboot组件文档","gitbook":"*","description":"Diboot组件文档"},"file":{"path":"文件组件/Excel数据导入.md","mtime":"2018-11-08T08:51:40.449Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-11-10T15:13:00.038Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

